/**
 * @param {number[]} salary
 * @return {number}
 */
export var average = function (salary) {
  let min = Number.MAX_SAFE_INTEGER,
    max = 0,
    sum = 0
  for (const item of salary) {
    max = Math.max(max, item)
    min = Math.min(min, item)
    sum += item
  }
  return (sum - min - max) / (salary.length - 2)
}
